//
//  YSLodingView.m
//  Yueshi
//
//  Created by Northwan on 15/8/26.
//  Copyright (c) 2015年 悦食中国. All rights reserved.
//

#import "YSLodingView.h"

@implementation YSLodingView

- (instancetype)initWithContentView:(UIView *__unused)contentView {
    UIImage *img = [UIImage imageNamed:@"icon_page_load"];
    UIImageView *lodinView = [[UIImageView alloc]initWithImage:img];
    
    CABasicAnimation* rotationAnimation;
    rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
    rotationAnimation.duration = 1.0;
    rotationAnimation.cumulative = YES;
    rotationAnimation.repeatCount = MAXFLOAT;
    [lodinView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
    
    self = [super initWithContentView:lodinView];
    
    return self;
}

- (instancetype)init {
    return [self initWithContentView:nil];
}

@end
